package com.tul.exercise.base.jmockit.helloworld;

import mockit.Expectations;
import mockit.Mocked;
import mockit.integration.junit4.JMockit;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertEquals;

/**
 * 《JMockit中文版入门指南》 1.3 Hello world示例
 *
 * @author tuliang
 *
 */
public class DemoServiceTest {

    @Mocked
    DemoService service;

    @Test
    public void testService() {
        String str = "Hello World";
        new Expectations(){{

            service.getMsg();
            result = str;
        }};

        // 最简单的测试Hello world
        assertEquals(service.getMsg(), str);

    }
}
